<template>
	<!-- Navbar -->
	<nav class="main-header navbar navbar-expand navbar-white navbar-light">
	  <!-- Left navbar links -->
	  <ul class="navbar-nav">
	    <li class="nav-item">
	      <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
	    </li>
	    <li class="nav-item d-none d-sm-inline-block">
	      <router-link to="/home" class="nav-link">主页</router-link>
	    </li>
	    <li class="nav-item d-none d-sm-inline-block">
	      <a href="#" @click="userLogout()" id="logout"  class="nav-link" v-if="loginUser!=null">注销 <i class="el-icon-sunrise-1"></i></a>
	    </li>
	  </ul>
	  
	</nav>
	<!-- /.navbar -->
</template>

<script>
	export default {
		name:"NavBar",
		computed:{
			loginUser(){
				return this.$store.getters.getLoginUser;
			}
		},
		methods:{
			userLogout(){
				this.$store.dispatch("logout");
				this.UserLoginStatus="N";
				this.$router.push("/login");
			}
		}
	}
</script>

<style>
#logout{
	position: absolute;
	right:50px;
}
</style>
